<?php

namespace app\admin\controller;
class Resume extends base
{
    //前置方法
    protected $beforeActionList = [
        'map'  =>  ['only'=>'index'],
    ];

    /**
     * 搜索
     */
    protected function map(){
        if ($this->request->isGet()) {
            $data = $this->request->param();
            $this->datas = array();
            if (!empty($data['start_time']) && !empty($data['end_time']) && (strtotime($data['start_time']) < strtotime($data['end_time']))) {
                $this->datas ['create_time'] = [
                    ['>', strtotime($data['start_time'])],
                    ['<', strtotime($data['end_time'])]
                ];
            }
            $this->datas['lang'] = cookie('think_var_admin');

        }
    }
    public function index(){

        $list = $this->model->alias('R')
            ->join('__USER__ c', 'c.id= R.uid')
            ->field('R.update_time,c.mobile,c.QQ,c.name,c.mail,c.id')
            ->paginate()
            ->appends($this->request->param());
        $this->assign('num', $this->model->where($this->datas)->count());
        $this->assign('list', $list);
        return $this->fetch();
    }
    /**
     * 查看
     */
    public function read($id)
    {

        /*列表start*/
        $data = model('user')->alias('U')
            ->join('__RESUME__ c', 'c.uid= U.id')
            ->field('U.*,c.center,c.file')
            ->where('U.id', $id)
            ->find();
        $this->assign([
            'data' => $data,
        ]);
        return $this->fetch();
    }

}
